package com.lianbang.staff.vm

import androidx.lifecycle.MutableLiveData
import cn.ubest.mvvmcore.base.BaseListViewModel
import cn.ubest.mvvmcore.base.BaseModel
import cn.ubest.mvvmcore.base.BaseViewModel
import cn.ubest.mvvmcore.bean.ListDataLoader
import cn.ubest.mvvmcore.interfaces.RequestHandler1Impl
import cn.ubest.mvvmcore.utils.ActivityManager
import cn.ubest.mvvmcore.utils.ToastUtils
import com.lianbang.staff.bean.HomeDetailBean
import com.lianbang.staff.bean.UserBean
import com.lianbang.staff.model.HomeModel
import com.lianbang.staff.module.main.MainActivity
import com.lianbang.staff.module.user.LoginActivity
import com.lianbang.staff.util.LoginUtils

/**
 * Created by maoqi on 2020/12/28.
 */
class MainVM : BaseListViewModel<HomeModel>() {

    override fun loadData(isInit: Boolean, vararg arg: Any) {
        setData(
            mutableListOf()
        )
    }

    fun getHomeDetail() {
        requestWithLife(object : RequestHandler1Impl<HomeDetailBean>(this) {
            override suspend fun request1(): HomeDetailBean {
                return mModel.getHomeDetail().resolveWrapper()
            }

            override fun onSuccess(t: HomeDetailBean) {
                mLiveData.postValue(t)
            }
        })
    }

}